package com.etc.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.etc.entity.CommentResult;
import com.etc.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class PaymentController {
    @Autowired
    private PaymentService paymentService;



    @RequestMapping("payment/delBatch")
    public CommentResult delBatch(@RequestBody String ids)
    {
        String res = JSON.toJSON(ids).toString();
        List<Integer> delIds = JSONArray.parseArray(res,Integer.class);
        int result = paymentService.delBatch(delIds);
        if (result>0){
            return new CommentResult(200,"删除成功");
        }
        return new CommentResult(444,"failed");
    }
}
